package c.c.a;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.os.Build.VERSION;
import android.provider.Settings.Global;
import android.text.TextUtils;
import android.util.Pair;
import com.huawei.hms.analytics.core.crypto.AesCipher.AesLen;

public final class w0 implements d1 {
    public static final p0<Boolean> a = new a();

    public static class a extends p0<Boolean> {
        public Object a(Object[] objArr) {
            boolean z = false;
            try {
                if (((Context) objArr[0]).getPackageManager().getPackageInfo("com.huawei.hwid", AesLen.ROOTKEY_COMPONET_LEN) != null) {
                    z = true;
                }
            } catch (Throwable unused) {
            }
            return Boolean.valueOf(z);
        }
    }

    public static class b extends c.c.a.d1.a {
        public long c = 0;
    }

    public static boolean c(Context context) {
        if (context == null) {
            return false;
        }
        return ((Boolean) a.b(context)).booleanValue();
    }

    public boolean a(Context context) {
        return c(context);
    }

    public c.c.a.d1.a b(Context context) {
        String string;
        b bVar = new b();
        if (VERSION.SDK_INT >= 24) {
            try {
                String string2 = Global.getString(context.getContentResolver(), "pps_oaid");
                string = Global.getString(context.getContentResolver(), "pps_track_limit");
                if (!TextUtils.isEmpty(string2)) {
                    bVar.a = string2;
                    bVar.b = Boolean.parseBoolean(string);
                    bVar.c = 202003021704L;
                    return bVar;
                }
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }
        string = "com.huawei.hwid";
        Pair pair = (Pair) new k1(context, new Intent("com.uodis.opendevice.OPENIDS_SERVICE").setPackage(string), new x0()).a();
        if (pair != null) {
            bVar.a = (String) pair.first;
            bVar.b = ((Boolean) pair.second).booleanValue();
            int i = 0;
            try {
                PackageInfo packageInfo = context.getPackageManager().getPackageInfo(string, 0);
                if (packageInfo != null) {
                    i = packageInfo.versionCode;
                }
            } catch (Throwable th2) {
                th2.printStackTrace();
            }
            bVar.c = (long) i;
        }
        return bVar;
    }
}
